<!--
@author		Yi Bo <etng2004@gmail.com>
@version	$Id: config_index.php 54 2007-09-07 05:59:18Z etng2004 $
@copyrithg	2006-2007 ETE.CN
@license 	PHP Version 3.0 {@link http://www.php.net/license/3_0.txt}
-->
<?php
$this->declareVars();
echo $this->render('header.php');
?>

<div class="Tips"> 本模块编写中 </div>
<style type="text/css">
.CurInfo h2.Title {
display:none;
}
</style>
<div id="InfoSelectorTarget"></div>
<h2 class="Title">基本参数<span><a href="#"><img src="<?php echo $this->wwwroot; ?>/images/gotop.gif" alt="至顶端" height="16" width="16"></a></span></h2>
<div id="BasciConfig"> 基本参数 </div>
<h2 class="Title">权限控制<span><a href="#"><img src="<?php echo $this->wwwroot; ?>/images/gotop.gif" alt="至顶端" height="16" width="16"></a></span></h2>
<div id="AclConfig">
<script language="JavaScript" type="text/javascript" src="<?php echo $this->wwwroot;?>/js/SlaveMasterCheckBoxes.js"></script>
<?php
function getSlaveMasterCheckBoxes($resource, $roles)
{
    $template = "'fields_resource_{$resource}__%s'";
    $acls = array();
    foreach ($roles as $role)
    {
        $acls[] = sprintf($template, $role);
    }
    $acl_ALL_s = sprintf($template, 'ALL');;
    $acl_s = implode(',', $acls);
    return "new SlaveMasterCheckBoxes({$acl_ALL_s},[{$acl_s}]);\n";
}

$s = "";
/**
 * 检查 Meta 并重新生成
 */
$cur_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
$meta['ACL']['resources'] = array();
$new_meta = array_combine($this->resources, $this->resources);
if(file_exists($cur_dir . '_meta_acl_resources.php'))
{
    include $cur_dir . '_meta_acl_resources.php';
}
$oldmeta = $meta['ACL']['resources'];
$oldmeta = array_diff_key($oldmeta, array_diff_key($oldmeta, $new_meta));
$new_meta = array_merge($new_meta, $oldmeta);
$content = file_get_contents($cur_dir . '__meta_header.php');
$content .= "\$meta['ACL']['resources'] =" . var_export($new_meta, true) . ";";
file_put_contents($cur_dir . '_meta_acl_resources.php', str_eol($content));

?>
<form method="post" action="<?php echo $this->base_url; ?>/acl/" id="frmConfigAcl" name="frmConfigAcl">
<?php
require_once ($this->mode=='flat')
?($cur_dir . '_acl_config_flat.php')
:($cur_dir . '_acl_config_tree.php');
?>
</form>
权限控制
</div>
<script language="JavaScript" type="text/javascript" src="<?php echo $this->wwwroot;?>/js/taobao_tabs.js"></script>
<script language="JavaScript" type="text/javascript">
var TabNames = [];
var TabIds =[];
convertTabMap({
'BasciConfig':'基本参数',
'AclConfig':'权限控制'
});
initInfoSelector();
</script>
<?php echo $this->render('footer.php');?>